package y23.Sep;

import java.util.Scanner;

public class Test19 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String A = in.nextLine();
        String B = in.nextLine();
        int count = 0;
        for(int i = 0;i < A.length()+1;i++){
            if(palindroom(montage(A,B,i))){
                count++;
            }
        }
        System.out.println(count);

    }
    public static String montage(String A,String B,int i ){
        String str1 = A.substring(0,i);
        String str2 = A.substring(i,A.length());
        return str1+B+str2;
    }
    public static Boolean palindroom(String str){
        int right = str.length()-1;
        int left = 0;
        while(left < right){
            if(str.charAt(left) != str.charAt(right)){
                return false;
            }
            left++;
            right--;
        }
        return true;
    }
}
